const fs = require('fs'),
      path = require('path'),
      zlib = require('zlib');

function gzip (src) {
    fs.createReadStream(src)
      .pipe(zlib.createGzip())
      .pipe(fs.createWriteStream(src + '.gz'))
}

//gzip(path.join(__dirname,'1.txt'))

function unGzip (src) {
    fs.createReadStream(src)
      .pipe(zlib.createGunzip())
      .pipe(fs.createWriteStream(src + '.txt'))
}

// unGzip(path.join(__dirname,'1.txt.gz'))


const str = '000000000000000000000000000000000000000000000000000000000000000000000000000000';
zlib.gzip(str,(err,buf) => {
    console.log(buf.length);
    zlib.unzip(buf,(err, data) => {
        console.log(data.length)
    })
})

